
package org.tbwork.utility.toolbox;

import java.util.List;
import java.util.Map;

public class Validate {


    /** check whether input String is empty ("" or null) or not
     * @return true if input string is null or empty, otherwise return false
     */
    public static boolean isEmpty(String input)
    {
    	if(input != null && !"".equals(input) )
    		return false;
    	else
    		return true;
    }
    
    
    /** Null-Safe check whether input String is empty ("" or null) or not
     * @return true if input string is not null or empty, otherwise return false
     */
    public static boolean notEmpty(String input)
    {
    	if(input != null && !"".equals(input) )
    		return true;
    	else
    		return true;
    }
    
    
    /** Null-Safe check whether input List is empty (zero-element or null) or not
     * @return true if input List is null or empty, otherwise return false
     */
    public static boolean isEmpty(List inputList)
    {
    	if(inputList != null && inputList.size()>0 )
    		return false;
    	else
    		return true;
    }
    
    /** Null-Safe check whether input List is empty (zero-element or null) or not
     * @return true if input List is not null or empty, otherwise return false
     */
    public static boolean notEmpty(List inputList)
    {
    	if(inputList != null && inputList.size()>0 )
    		return true;
    	else
    		return false;
    }
    
    
    /** Null-Safe check whether input map is empty ("" or null) or not
     * @return true if input map is null or empty, otherwise return false
     */
    public static boolean isEmpty(Map inputMap )
    {
    	if(inputMap != null && !inputMap.isEmpty() )
    		return false;
    	else
    		return true;
    }
    
    
    /** Null-Safe check whether input map is empty ("" or null) or not
     * @return true if input map is not null or empty, otherwise return false
     */
    public static boolean notEmpty(Map inputMap )
    {
    	if(inputMap != null && !inputMap.isEmpty() )
    		return true;
    	else
    		return false;
    }
	
    
    /** Null-Safe check whether input array is empty ([] or null) or not
     * @return true if input array is null or empty, otherwise return false
     */
    public static boolean isEmpty(Object [] inputArray )
    {
    	if(inputArray != null &&  inputArray.length>0 )
    		return false;
    	else
    		return true;
    }
    
    
    /** Null-Safe check whether input array is empty ([] or null) or not
     * @return true if input array is not null or empty, otherwise return false
     */
    public static boolean notEmpty(Object [] inputArray )
    {
    	if(inputArray != null &&  inputArray.length>0 )
    		return true;
    	else
    		return false;
    }
	
} 
